import logging

import allure
from selenium.webdriver.common.by import By

from ding.LitemallPrac.page_objects.base_page import BasePage
from ding.LitemallPrac.page_objects2.product_comment import CommentPage


class HomePage(BasePage):
    _MENU_PPRODUCT_MANAGE=(By.XPATH,"//span[contains(text(),'商品管理')]")
    _MENU_PRODUCT_LAUNCH = (By.XPATH,"//span[contains(text(),'商品上架')]")
#进入商品上架页面
    #点击菜单
    with allure.step("点击菜单"):
        def got_go_product_launch(self):
            # 点击“商品管理”菜单
            logging.info("点击“商品管理”菜单")
            self.do_click(*self._MENU_PPRODUCT_MANAGE)
            # 点击“商品上架”
            logging.info("点击“商品上架”菜单")
            self.do_click(*self._MENU_PRODUCT_LAUNCH)

            from ding.LitemallPrac.page_objects.paoduct_launch_page import ProductLaunchPage
            return ProductLaunchPage(self.driver)



    _MENU_PPRODUCT_MANAGE = (By.XPATH, "//span[contains(text(),'商品管理')]")
    _MENU_PRODUCT_LAUNCH = (By.XPATH, "//span[contains(text(),'商品评论')]")
#进入商品评论页面
    # 点击菜单
    with allure.step("点击菜单"):
        def got_go_comment_launch(self):
            # 点击“商品管理”菜单
            logging.info("点击“商品管理”菜单")
            self.do_click(*self._MENU_PPRODUCT_MANAGE)
            # 点击“商品评论”
            logging.info("点击“商品评论”菜单")
            self.do_click(*self._MENU_PRODUCT_LAUNCH)

            return CommentPage(self.driver)



